

class Solution:
    def maxNumber(self, nums1, nums2, k):
        if(len(nums1)+len(nums2)<=k):
            return nums1+nums2
        else:
            if(self.checkEmpty(nums1)):
                return nums2
            elif(self.checkEmpty(nums2)):
                return nums1



    def checkEmpty(self,nums):
        if(len(nums))<=0:
            return True
        return False
    def checkOne(self,nums):
        if(len(nums))==1:
            return True
        return False

if __name__ == '__main__':
    s=Solution()
    rel=s.maxNumber(nums1=[3,6,7,8,9],nums2=[2],k=4)
    print(rel)
